@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="m-b">
		<a href="javascript:;" class="btn btn-default" onclick="history.back();"><i class="fa fa-angle-double-left"></i> 返回列表</a>
	</div>
	<div class="ibox">
		<div class="ibox-title">
			<h5>修改页面广告位</h5>
		</div>
		<div class="ibox-content">
			<form id="formEdit" method="post">
				<div class="form-group">
					<label>标题</label>
						<input type="text" name="title" value="{{$title}}" class="form-control" required="" autofocus />
				</div>
				<div class="form-group">
					<label>尺寸</label>
					<div class="input-group">
						<div class="input-group-addon">宽度</div>
						<input type="text" name="width" value="{{$width}}" class="form-control" maxlength="4" onkeyup="value=value.replace(/[^\d]/g,'');" required />
						<div class="input-group-addon">px</div>
					</div>
				</div>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon">高度</div>
						<input type="text" name="height" value="{{$height}}" class="form-control" maxlength="4" onkeyup="value=value.replace(/[^\d]/g,'');" required />
						<div class="input-group-addon">px</div>
					</div>
				</div>
				<input type="hidden" name="id" value="{{$id}}" />
				<input type="hidden" name="status" value="{{$status}}" />
				<button class="btn btn-warning btn-w-m" type="submit">提交</button>
			</form>
		</div>
	</div>
</div>
@endsection

@section('pagescript')
<script>
	$("#side-menu li[rel='pageadver']").addClass("active")
	  .parents("ul").addClass("in").parents("li").addClass("active");

	$("#formEdit").on("submit", function(){
		var formdata = $(this).serialize();
		$.post("{{url('admin/pageadver/update')}}", formdata, function(){
			window.location.href = document.referrer;
		}).fail(failure);
		return false;
	});
</script>
@endsection
